package com.crawler.waf.serializer;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * 
 * @author rubekid
 *
 * 2017年2月18日 下午10:43:07
 */
public class GenderSerializer extends JsonSerializer<Integer> {

	  
	@Override
	public void serialize(Integer value, JsonGenerator gen, SerializerProvider serializers)
			throws IOException, JsonProcessingException {
		String text = "未设置";
		if(value != null){
			if(value == 0){
				text =  "女";
			}
			else if(value == 1){
				text = "男";
			}
		}
		gen.writeString(text);
	}  
}  